package com.study.jyg.rxjava2study.activity;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.google.android.material.appbar.AppBarLayout;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;

import com.study.jyg.rxjava2study.R;
import com.study.jyg.rxjava2study.activity.design.BottomSheetActivity;
import com.study.jyg.rxjava2study.activity.design.DesignAnimationActivity;
import com.study.jyg.rxjava2study.base.BasicActivity;
import com.study.jyg.rxjava2study.utils.AdapterInit;

import java.util.Arrays;

import butterknife.BindView;

/**
 * design库 效果等
 */
public class DesignSelectActivity extends BasicActivity {

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.appBar)
    AppBarLayout appBar;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;


    private String[] datas = {"TextInputLayout", "BottomSheet效果","design动画效果", "AppBar效果"};
    private BaseQuickAdapter< String, BaseViewHolder> adapter;

    @Override
    protected int getLayout() {
        return R.layout.activity_design_select;
    }

    @Override
    protected void initView() {
        toolbar.setTitle("进入Martal Design");
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(v -> finish());
        initAdapter();
    }

    private void initAdapter(){
        adapter = AdapterInit.initRecyclerView( recyclerView, R.layout.item_recyclerview_textview, Arrays.asList(datas), new LinearLayoutManager(mContext), (helper, item) -> {
            helper.setText(R.id.tvItem, item);
        }, (adapter1, view, position) -> {
            switch ( position){
                case 0://TextInputLayout + Edit/TextInputEdit
                        startActivity(TextInputLayoutActivity.class);
                    break;
                case 1:
                    startActivity(BottomSheetActivity.class);
                    break;
                case 2:
                    startActivity(DesignAnimationActivity.class);
                    break;
                case 3:
                    startActivity(AppBarActivity.class);

                    break;
                case 4:

                    break;
                case 5:

                    break;
            }
        });
    }
}
